<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021-04-27
 * Time: 23:24
 */
namespace app\admin\controller;
use app\admin\controller\command\AdminController;
use app\admin\controller\service\MenuService;
use think\facade\Cache;

class Ajax extends AdminController
{
    public function initAdmin(){
        $menuService = new MenuService(session('adminuser.id'));
//        echo '<pre>';
//        print_r($menuService->getHomeInfo());
//        print_r($menuService->getMenuTree());
//        exit;
        $adminuser = session('adminuser');
        $data = [
            'logoInfo' => [
                'title' => 'LAYUI MINI',
                'image' => '/static/layuimini/images/logo.png',
                'href'  => __url('index/index'),
            ],
            'homeInfo' => $menuService->getHomeInfo(),
            'menuInfo' => $menuService->getMenuTree(),
        ];
//        echo '<pre>';
//        print_r($data);
//        exit;
        return json($data);
    }
    /**
     * 清理缓存接口
     */
    public function clearCache()
    {
        Cache::clear();
        return json(['code'=>1,'msg'=>'清除成功']);
    }
}